<?php
	function interface_to_group($interface_group_id,$interface_id){
		db_execute('Insert into plugin_nms_interfacegroup (interface_group_id, interface_id)
							values ('.$interface_group_id.','.$interface_id.')');
	}
	function check_add_interface_to_group($interface_group_id,$interface_id){
		$check =false;
		$data = db_fetch_assoc('SELECT * FROM  plugin_nms_interfacegroup WHERE interface_group_id ='.$interface_group_id.' and interface_id ='.$interface_id.'');
		if(!empty($data)){
			$check =true;
		}
		return $check;
	}
	function remove_interface_to_group($id){
		db_execute('DELETE FROM plugin_nms_interfacegroup
 				WHERE intergroup_id = '.$id.'');
	}
	function remove_interface_to_group_1($id,$id_group){
		db_execute('DELETE FROM plugin_nms_interfacegroup
 				WHERE interface_id = '.$id.' and interface_group_id ='.$id_group.'');
	}
	function delete_interface_to_group($id){
		db_execute('DELETE FROM plugin_nms_interfacegroup
 				WHERE interface_id = '.$id.'');
	}
	function remove_group_interface($id){
		db_execute('DELETE FROM plugin_nms_groupname
 				WHERE interface_group_id = '.$id.'');
	}
	function add_group_interface($group_name){
		db_execute('Insert into plugin_nms_groupname (group_name)
							values ("'.$group_name.'")');
	}
	function check_add_group_interface($group_name){
		$check =false;
		$data = db_fetch_assoc('SELECT * FROM  plugin_nms_groupname WHERE group_name ="'.$group_name.'"');
		if(!empty($data)){
			$check =true;
		}
		return $check;
	}
/*
 * Group phone management */
	function add_groupinter_groupphone($group_inter,$group_phone){
		db_execute('Insert into plugin_nms_contactdetail (contact_group_id, interface_group_id)
							values ('.$group_phone.','.$group_inter.')');
	}
	function remove_add_groupinter_groupphone($id_group){
		db_execute('DELETE FROM plugin_nms_contactdetail
 				WHERE intercontact_id = '.$id_group.'');
	}
	function check_add_groupinter_groupphone($check_groupinter ,$check_groupphone){
		$check =false;
		$data = db_fetch_assoc('SELECT * FROM  plugin_nms_contactdetail WHERE contact_group_id ='.$check_groupphone.' and interface_group_id ='.$check_groupinter.'');
		if(!empty($data)){
			$check =true;
		}
		return $check;
	}
	function check_id_phone_from_group_name($id_group_name){
		$return = db_fetch_assoc('SELECT intercontact_id from plugin_nms_contactdetail where interface_group_id ="'.$id_group_name.'" ');
		return $return;
	}
?>